package com.inch.web.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/jump")
public class ForwardController {
    @RequestMapping("/test1")
    public String test1(){
        System.out.println("test1");
//        return "index";
        //forward follows the full path of the view file
//        return "forward:/hello1.jsp";
        //recommend use
        return "jsp/hello1";
    }
    @RequestMapping("/test2")
    public String test2() {
        System.out.println("test2");
        // jump to test1()
//        return "forward:/jump/test1";
        //anther way to jump to test1()
        return "forward:test1";
    }
    @RequestMapping("/test3")
    public String test3() {
        System.out.println("test3");
        return "redirect:/jsp/hello1.jsp";
    }
    @RequestMapping("/test4")
    public String test4() {
        System.out.println("test4");
//        return "redirect:/jump/test3";
        return "redirect:test3";
    }




}
